import { BasicDelModel } from '../model/baseModel';
import { UserSearchModel, UserVOModel } from './model/userModel';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  PageApi = '/sys/user/page',
  AddApi = '/sys/user/add',
  EditApi = '/sys/user/edit',
  DelApi = '/sys/user/delete',
}

/**
 * @description: 获取系统用户列表数据
 */
export const getUserPageApi = (data: UserSearchModel) => {
  return defHttp.post({ url: Api.PageApi, data });
};

/**
 * @description: 新增系统用户
 */
export const saveUserApi = (data: UserVOModel) => {
  return defHttp.post({ url: Api.AddApi, data });
};

/**
 * @description: 修改系统用户
 */
export const updateUserApi = (data: UserVOModel) => {
  return defHttp.post({ url: Api.EditApi, data });
};

/**
 * @description: 删除系统用户
 */
export const delUserApi = (ids: string[]) => {
  const data: BasicDelModel = {
    ids: ids
  }
  return defHttp.post({ url: Api.DelApi, data });
};
